'This class allows you to handle specific events on the settings class:
' The SettingChanging event is raised before a setting's value is changed.
' The PropertyChanged event is raised after a setting's value is changed.
' The SettingsLoaded event is raised after the setting values are loaded.
' The SettingsSaving event is raised before the setting values are saved.
Partial Friend NotInheritable Class Settings
    Sub UpdateGUI(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) Handles Me.PropertyChanged
        Select Case e.PropertyName
            Case "EmuTraceColour"
                If Not IsNothing(frmBikiMain) Then
                    frmBikiMain.SetEmulatorColour(Me.EmuTraceColour)
                End If
            Case "TraceColour"
                If Not IsNothing(frmBikiMain) Then
                    frmBikiMain.SetTraceColour(Me.TraceColour)
                    'frmBikiMain.bGrid.TraceColour = Me.TraceColour
                End If
            Case "stream_Imperial"
                If Not IsNothing(frmBikiMain) Then
                    If Me.stream_Imperial Then
                        frmBikiMain.gSPEED.Metric = False
                    Else
                        frmBikiMain.gSPEED.Metric = True
                    End If
                End If
                'Case "Graph_GradiantColour"
                '    If Not IsNothing(frmBikiMain) Then
                '        frmBikiMain.LibGraph2D1.bgGradientColour = My.Settings.Graph_GradiantColour
                '        frmBikiMain.LibGraph2D2.bgGradientColour = My.Settings.Graph_GradiantColour
                '    End If
                'Case "Graph_BackColour"
                '    If Not IsNothing(frmBikiMain) Then
                '        frmBikiMain.LibGraph2D1.bgColour = My.Settings.Graph_BackColour
                '        frmBikiMain.LibGraph2D2.bgColour = My.Settings.Graph_BackColour
                '    End If
            Case "stream_auto"
                If Not IsNothing(frmBikiMain) Then
                    frmBikiMain.tmrIdle.Enabled = My.Settings.stream_auto
                End If
        End Select
    End Sub

    ''' <summary>
    ''' Function sets up the properties of controls after settings re-loaded. ones that aren't automoaticly poled
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Sub UpdateAfterLoaded(ByVal sender As Object, ByVal e As System.Configuration.SettingsLoadedEventArgs) Handles Me.SettingsLoaded
        If Me.stream_Imperial Then
            frmBikiMain.gSPEED.Metric = False
        Else
            frmBikiMain.gSPEED.Metric = True
        End If
        ' frmBikiMain.LibGraph2D1.Range = My.Settings.Graph1_Range
        'frmBikiMain.LibGraph2D2.Range = My.Settings.Graph2_Range
        frmBikiMain.Graph3D1.LookLeftRight = My.Settings.Graph3d_LR
        frmBikiMain.Graph3D1.LookUpDown = My.Settings.Graph3d_Up
        'frmBikiMain.LibGraph2D1.DisplayDefaults = My.Settings.Graph1_MenuItems
        'frmBikiMain.LibGraph2D2.DisplayDefaults = My.Settings.Graph2_MenuItems
    End Sub

    Private Sub Settings_SettingsSaving(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.SettingsSaving
        ' My.Settings.Graph1_Range = frmBikiMain.LibGraph2D1.Range
        ' My.Settings.Graph2_Range = frmBikiMain.LibGraph2D2.Range
        My.Settings.Graph3d_LR = frmBikiMain.Graph3D1.LookLeftRight
        My.Settings.Graph3d_Up = frmBikiMain.Graph3D1.LookUpDown
        'My.Settings.Graph1_MenuItems = frmBikiMain.LibGraph2D1.DisplayDefaults
        'My.Settings.Graph2_MenuItems = frmBikiMain.LibGraph2D2.DisplayDefaults
    End Sub
End Class